package main

import "fmt"

func main() {
	fmt.Println(lengthOfLastWord("a"))
}

func lengthOfLastWord(s string) int {
	end := len(s) - 1
	for ; s[end] == ' '; end-- {
	}
	start := end
	for ; start >= 0 && s[start] != ' '; start-- {
	}
	return end - start
}
